import request from "@/utils/request";
import type { AxiosPromise } from "axios";
//获取角色详情
export const _getUserInoById = async (params: object): Promise<UserInfo> => {
  const response = await request({
    url: '/user/query-system-user-byId',
    method: 'GET',
    params: params,
  });
  return response.data; // Assuming the r`esponse contains the data in this format
}

//获取角色列表
export const _getUserList = async (): AxiosPromise<UserInfo[]> => {
  return request({
    url: '/user/query-system-user-list',
    method: 'GET',
  });
}

//新增用户
export const _saveUserInfo = async(param : object) : Promise<AxiosPromise> =>{
  const response = await request({
    url: '/user/insert',
    method: 'POST',
    data: param
  });
  return response;
}

//修改用户信息
export const _updateUserInfo = async(param : object) : Promise<AxiosPromise> =>{
  const response = await request({
    url: '/user/modify',
    method: 'POST',
    data: param
  });
  return response;
}

export interface UserInfo {
    id:string;
    deptId: string;
    userName :string;
    nickName : string;
    userType : string;
    email: string;
    phoneNumber :string;
    sex : string;
    avatar : string;
    status: string;
    delFlag :string;
    loginIp : string;
    loginDate : string;
    createDept: string;
    remark :string;
    roleIds : string;
  }
